package com.yinhe.system.service.impl;

import com.yinhe.common.utils.DateUtils;
import com.yinhe.system.domain.SysKnowledge;
import com.yinhe.system.mapper.SysKnowledgeMapper;
import com.yinhe.system.service.ISysKnowledgeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 知识存储Service业务层处理
 * 
 * @author ChenMu
 * @date 2022-05-15
 */
@Service
public class SysKnowledgeServiceImpl implements ISysKnowledgeService
{
    @Autowired
    private SysKnowledgeMapper sysKnowledgeMapper;

    /**
     * 查询知识存储
     * 
     * @param knowId 知识存储主键
     * @return 知识存储
     */
    @Override
    public SysKnowledge selectSysKnowledgeByKnowId(Integer knowId)
    {
        return sysKnowledgeMapper.selectSysKnowledgeByKnowId(knowId);
    }

    /**
     * 查询知识存储列表
     * 
     * @param sysKnowledge 知识存储
     * @return 知识存储
     */
    @Override
    public List<SysKnowledge> selectSysKnowledgeList(SysKnowledge sysKnowledge)
    {
        return sysKnowledgeMapper.selectSysKnowledgeList(sysKnowledge);
    }

    /**
     * 新增知识存储
     * 
     * @param sysKnowledge 知识存储
     * @return 结果
     */
    @Override
    public int insertSysKnowledge(SysKnowledge sysKnowledge)
    {
        sysKnowledge.setCreateTime(DateUtils.getNowDate());
        return sysKnowledgeMapper.insertSysKnowledge(sysKnowledge);
    }

    /**
     * 修改知识存储
     * 
     * @param sysKnowledge 知识存储
     * @return 结果
     */
    @Override
    public int updateSysKnowledge(SysKnowledge sysKnowledge)
    {
        sysKnowledge.setUpdateTime(DateUtils.getNowDate());
        return sysKnowledgeMapper.updateSysKnowledge(sysKnowledge);
    }

    /**
     * 批量删除知识存储
     * 
     * @param knowIds 需要删除的知识存储主键
     * @return 结果
     */
    @Override
    public int deleteSysKnowledgeByKnowIds(Integer[] knowIds)
    {
        return sysKnowledgeMapper.deleteSysKnowledgeByKnowIds(knowIds);
    }

    /**
     * 删除知识存储信息
     * 
     * @param knowId 知识存储主键
     * @return 结果
     */
    @Override
    public int deleteSysKnowledgeByKnowId(Integer knowId)
    {
        return sysKnowledgeMapper.deleteSysKnowledgeByKnowId(knowId);
    }
}
